export default function(sequelize, DataTypes) {
  return sequelize.define('t_captcha_new', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "主键"
    },
    code: {
      type: DataTypes.STRING(10),
      allowNull: true,
      comment: "验证码"
    },
    type: {
      type: DataTypes.TINYINT,
      allowNull: false,
      comment: "验证码用途\/类型 \r\n1. 修改密码确认邮箱\r\n2. 修改密码唯一验证码\r\n3. 手机注册验证码\r\n4. 手机登录验证码\r\n5. 手机修改密码验证码\r\n6. 邮箱注册验证码"
    },
    deadline: {
      type: DataTypes.CHAR(13),
      allowNull: true,
      comment: "验证码最后时间"
    },
    email: {
      type: DataTypes.STRING(350),
      allowNull: false,
      comment: "邮箱"
    }
  }, {
    sequelize,
    tableName: 't_captcha_new',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
      {
        name: "uni",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "email" },
          { name: "type" },
        ]
      },
      {
        name: "search_type",
        using: "BTREE",
        fields: [
          { name: "type" },
        ]
      },
      {
        name: "search_time",
        using: "BTREE",
        fields: [
          { name: "deadline" },
        ]
      },
      {
        name: "search_code",
        using: "BTREE",
        fields: [
          { name: "code" },
        ]
      },
    ]
  });
};
